<?php

namespace App\Http\Controllers;

use App\Http\Service\CommentvoteService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Config;

class CommentvoteController extends BaseController
{
    private $getRules=[
            'unique_id'=> 'required',
            'people_id'=> 'required',
            'content'=> 'required',
        ];
    private  $getRulesMessage=[
            'unique_id.required'=> '唯一标识【unique_id】不能为空',
            'people_id.required'=> '用户id【people_id】不能为空',
            'content.required'=> '回复内容【content】不能为空',
        ];
    public $repository;
    #统计评论区的点赞和踩的数量
    public function __construct(CommentvoteService $repository)
    {
        parent::__construct();
        $this->repository = $repository;
    }
    public function getList(Request $request)
    {
        $data=[
            'type'=>$request->input("type"),
        ];
        $this->success($this->repository->getList($request,$data));
    }
   
    #添加点赞/踩次数
    public function commentvoteadd(Request $request)
    {
        

        $data=[
            'comment_id'=>$request->json("comment_id"),
            'vote_type'=>$request->json("vote_type"),
            'user_id'=>$request->json("user_id"),
        ];

        $this->success($this->repository->addData($request,$data));

    }
   
  

}
